<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .title {
            width: 650px;
            margin-left: 30px;
            padding-top: 50px;
            padding-bottom: 50px;
            border-bottom-style: solid;
            border-color: rgba(121, 131, 132, 0.5);
            border-width: 2px;

        }

        .title2 {
            color: #798384;
            margin-top: -20px;
        }

        ul {
            width: 850px;
            height: 450px;
        }

        li {
            float: left;
            display: block;
            width: 80px;
            height: 50px;
            margin-top: 25px;
            margin-left: 30px;
            padding-top: 25px;
            border: #ffffff  solid 1px;
        }
    </style>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>

</head>
<body>
<div class="title">
    <h1>ToDay</h1>
    <h3 class="title2">Monday 8,August</h3>
</div>
<ul id="ul">
    <li><span>1</span></li>
    <li><span>2</span></li>
    <li><span>3</span></li>
</ul>

<script>
    var max = 6 * 7;
    const $ul = $('ul');
    for (var i = 0; i < max; i++) {
        $ul.append($('<li>'));
    }

    var lis = $('li');
    var lisTitle = ['星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
    for (var i = 0; i < 7; i++) {
        lis[i].innerHTML = lisTitle[i];
        lis[i].style.fontWeight = '1000';
        lis[i].style.fontSize = '20px';
    }
    var j = 8;
    for (var i = 1; i < 32; i++) {
        if (j === 42) {
            i = 1;
        }
        lis[j].style.color = 'rgb(201,210,206)';
        lis[j].innerHTML = '&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp' + i;
        j++;
    }

    var clearBackGround = function () {
        for (var i = 0; i < 42; i++) {
            lis[i].style.backgroundColor = '';
            lis[i].style.borderColor = 'rgb(255,255,255)';
        }
    };

    var onMouseDown = function (event) {
        var set = event.target;
        if (set.tagName === 'LI') {
            set.style.transition = 'all';
            set.style.transitionDuration = '1s';
            set.style.backgroundColor = 'rgb(0,218,146)';
            set.style.borderStyle = 'solid';
            set.style.borderWidth = '1px';
            set.style.borderColor = 'green';
            set.style.borderRadius = '500px';
        } else if (set.tagName !== 'LI') {

        }

    };

    $(document).click(function (event) {
        clearBackGround();
        onMouseDown(event);
    });

    setTimeout(()=>{
        $('li:eq(1)').click();
    },2000);

</script>
</body>
</html>